/**
 * title: 忘记密码
 */
import React, { Component } from 'react';
import Steps from './components/Steps';
import StepFirst from './components/StepFirst';
import StepSecond from './components/StepSecond';
import StepThird from './components/StepThird';
import { connect } from 'dva';
import styles from './styles.less';

const StepContents = [StepFirst, StepSecond, StepThird];

@connect(({ resetPassword: { information } }) => ({
  information,
}))
class ResetPassword extends Component {
  state = {
    current: 0,
  };
  setCurrentStep = current => this.setState({ current });

  handleSubmit = e => {
    e.preventDefault();
  };

  render() {
    const { current } = this.state;
    const StepContent = StepContents[current];
    const { history, information } = this.props;
    const PartRightComponent = (
      <div className={styles.wrapper}>
        <div className={styles.content}>
          <h2>忘记密码</h2>
          <Steps current={current} />
          <div className={`${styles.stepContent} login-wrapper`}>
            <StepContent
              setStep={this.setCurrentStep}
              information={information}
              history={history}
            />
          </div>
        </div>
      </div>
    );
    return PartRightComponent;
  }
}
export default ResetPassword;
